/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model.Entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ubuntu
 */
@Entity
@Table(catalog = "copa", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Jogos.findAll", query = "SELECT j FROM Jogos j"),
    @NamedQuery(name = "Jogos.findById", query = "SELECT j FROM Jogos j WHERE j.id = :id"),
    @NamedQuery(name = "Jogos.findBySelecoes", query = "SELECT j FROM Jogos j WHERE j.selecoes = :selecoes"),
    @NamedQuery(name = "Jogos.findByDataHora", query = "SELECT j FROM Jogos j WHERE j.dataHora = :dataHora")})
public class Jogos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    private String selecoes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "data_hora")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataHora;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jogoId")
    private Collection<Ingressos> ingressosCollection;

    public Jogos() {
    }

    public Jogos(Integer id) {
        this.id = id;
    }

    public Jogos(Integer id, String selecoes, Date dataHora) {
        this.id = id;
        this.selecoes = selecoes;
        this.dataHora = dataHora;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSelecoes() {
        return selecoes;
    }

    public void setSelecoes(String selecoes) {
        this.selecoes = selecoes;
    }

    public Date getDataHora() {
        return dataHora;
    }

    public void setDataHora(Date dataHora) {
        this.dataHora = dataHora;
    }

    @XmlTransient
    public Collection<Ingressos> getIngressosCollection() {
        return ingressosCollection;
    }

    public void setIngressosCollection(Collection<Ingressos> ingressosCollection) {
        this.ingressosCollection = ingressosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Jogos)) {
            return false;
        }
        Jogos other = (Jogos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Jogos[ id=" + id + " ]";
    }
    
}
